package com.example.film.mapper;

import com.example.film.entity.NewCinema;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NewCinemaMapper {
    //新增影院table-->newcinema
    //查看新增影院信息
    @Select("select id,cinemaName,cinemaArea,screenNumber,openDate from newcinema")
    List<NewCinema> findNewCinema();

    //分页查询新增影院信息
    @Select("select id,cinemaName,cinemaArea,screenNumber,openDate from newcinema LIMIT #{pageSize} OFFSET #{startIndex}")
    List<NewCinema> findNewCinemaInfo(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize);

    //根据年份和月份分页显示新增影院信息
    @Select("select id,cinemaName,cinemaArea,screenNumber,openDate from newcinema where year(opendate)=#{year} and month(opendate)=#{month} LIMIT #{pageSize} OFFSET #{startIndex}")
    List<NewCinema> findNewCinemaByDate(@Param("year") Integer year,@Param("month") Integer month,@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize);
}
